import Vue from 'vue'
import Router from 'vue-router'
import iView from 'iview';


Vue.use(Router)
Vue.use(iView)

import Admin from '../components/Admin'
import AddTask from '../components/task/AddTask'
import NextDo from '../components/task/NextDo'
import Done from '../components/task/Done'
const router = new Router({
  routes: [
    {
      path: '/main',
      name: 'admin',
      component: Admin,
      children: [
        {
          path: 'addTask',
          component: AddTask
        },
        {
          path: 'nextDO',
          component: NextDo
        },
        {
          path: 'Done',
          component: Done
        }
      ]
    }
  ]
})

router.beforeEach((to, from, next) => {
  // console.log(to)
  // console.log(from)
  // console.log(next)
  // let token = window.localStorage.getItem('token')
  // if (to.matched.some(record => record.meta.requiresAuth) && (!token || token === null)) {
  //   next({
  //     path: '/login',
  //     query: { redirect: to.fullPath }
  //   })
  // } else {
  //   next()
  // }
  next()
})


export default router
